using System;
using System.Collections.Generic;
using System.Text;
using System.Data;


namespace THSLib
{
    #region STModuleDescriptionsController
    /// <summary>
    /// This object represents the properties and methods of a ModuleDescription.
    /// </summary>
    public class STModuleDescriptionsController:BaseBusinessController
    {
        #region SP Name

        //Select By ForeignKey Queries
        /*Remove cause of not use
        private readonly string spGetSTModuleDescriptionsBySTLanguageID = "STModuleDescriptions_SelectBySTLanguageID";
        private readonly string spGetSTModuleDescriptionsBySTModuleID = "STModuleDescriptions_SelectBySTModuleID";*/

        //Select By all foreignkey query

        /*Remove cause of not use
        private readonly string spGetSTModuleDescriptionsBySTModuleIDAndSTLanguageID = "STModuleDescriptions_SelectBySTModuleIDAndSTLanguageID";*/

        private readonly string spGetSTModuleDescriptionsBySTModuleNameAndGELanguageName =
                                "STModuleDescriptions_SelectBySTModuleNameAndGELanguageName";

        //Delete by foreignkey Queries
        /*Remove cause of not use
        private readonly string spDeleteSTModuleDescriptionsBySTLanguageID = "STModuleDescriptions_DeleteBySTLanguageID";
        private readonly string spDeleteSTModuleDescriptionsBySTModuleID = "STModuleDescriptions_DeleteBySTModuleID";*/

        #endregion

        public STModuleDescriptionsController()
        {
            //dal = new STModuleDescriptionsDAL();
            dal = new DALBaseProvider("STModuleDescriptions", typeof(STModuleDescriptionsInfo));
        }       

        
        public STModuleDescriptionsInfo GetModuleDescriptionByModuleNameAndLanguageName(String strModuleName, String strLanguageName)
        {
            return (STModuleDescriptionsInfo)dal.GetDataObject(spGetSTModuleDescriptionsBySTModuleNameAndGELanguageName,
                                                               strModuleName, strLanguageName);            
        }

        public String GetDescriptionByModuleNameAndLanguageName(String strModuleName, String strLanguageName)
        {
            String strModuleDescription=String.Empty;
            STModuleDescriptionsInfo objSTModuleDescriptionsInfo = GetModuleDescriptionByModuleNameAndLanguageName(strModuleName, strLanguageName);
            if (objSTModuleDescriptionsInfo != null)
                strModuleDescription = objSTModuleDescriptionsInfo.STModuleDescriptionDescription;
            return strModuleDescription;
        }

        public STModuleDescriptionsInfo GetObjectByModuleID(int moduleID)
        {
            String query = String.Format("SELECT * FROM STModuleDescriptions WHERE STModuleID = {0}", moduleID);
            DataSet ds = GetDataSet(query);
            if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0)
                return null;
            else
                return (STModuleDescriptionsInfo)GetObjectFromDataRow(ds.Tables[0].Rows[0]);
        }

        public STModuleDescriptionsInfo GetObjectByDescription(String description)
        {
            String query = String.Format("SELECT * FROM STModuleDescriptions WHERE STModuleDescriptionDescription = N'{0}'", description);
            DataSet ds = GetDataSet(query);
            if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0)
                return null;
            else
                return (STModuleDescriptionsInfo)GetObjectFromDataRow(ds.Tables[0].Rows[0]);
        }

    }
    #endregion

}
